package Biblioteca;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.AttributedCharacterIterator;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;

import Principal.Projetil;
import Utils.CONSTANTES;
import Utils.ImageRegistry;
import Testes.*;


public class Cenario extends JFrame{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Image image;
	private ImageIcon imageIcon;
	private double frameWidth;
	private double frameHeight;

	public Cenario(String tipo) throws FileNotFoundException, IOException{
		super("Beta-Shooting");
		image = carregaImagem(tipo);
		System.out.println(ImageRegistry.PROJETIL);
		imageIcon = new ImageIcon(image);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
		//super.setExtendedState(JFrame.MAXIMIZED_BOTH);
		setLocationRelativeTo(null); // Centraliza a Janela no centro da tela
		//setLayout(null);
		setVisible(true);
		//setResizable(false);
	}

	//*****************************************************************************************************

    public void paint(Graphics g){	
    	super.paint(g);
		frameWidth = getSize().getWidth();
		frameHeight = getSize().getHeight();

		System.out.println(frameWidth);
		System.out.println(frameHeight);

		Graphics2D graphics2D = (Graphics2D) g;

		//This will draw drawImageIntoJFrame.jpg into JFrame
		//graphics2D.drawImage(image,0,0,(int)frameWidth,(int)frameHeight,0,0,imageIcon.getIconWidth(),imageIcon.getIconHeight(),null);
	}
    
	//*****************************************************************************************************

	private Image carregaImagem(String tipo){
		return Toolkit.getDefaultToolkit().createImage(tipo);
	}

}
